#include "player.h"

Player::Player(int r, int c) : _posRow(r), _posCol(c), _state(2){

    /* carregar 4 imagens do jogador */
    img = (ALLEGRO_BITMAP**) malloc(sizeof(ALLEGRO_BITMAP*) * 4);

    img[0] = Resources::instance()->image( Resources::PLAYER_UP);
    img[1] = Resources::instance()->image( Resources::PLAYER_RIGHT);
    img[2] = Resources::instance()->image( Resources::PLAYER_DOWN);
    img[3] = Resources::instance()->image( Resources::PLAYER_LEFT);
}

ALLEGRO_BITMAP* Player::render(){
    return img[_state];
}

Player::~Player(){
    for(register int i = 0; i<4; ++i){
        al_destroy_bitmap(img[i]);
    }
    delete img;
}
